//
//  UIView+UIView_Extend.m
//  BondCity
//
//  Created by Lonely丶晏袁杰 on 16/6/22.
//
//

#import "UIView+UIView_Extend.h"

@implementation UIView (UIView_Extend)
- (UIViewController*)viewController {
    for (UIView* next = [self superview]; next; next = next.superview) {
        UIResponder* nextResponder = [next nextResponder];
        if ([nextResponder isKindOfClass:[UIViewController class]]) {
            return (UIViewController*)nextResponder;
        }
    }
    return nil;
}
-(UINavigationController *)navigationController{
    if (self.viewController.navigationController) {
        return self.viewController.navigationController;
    }
    return nil;
}
@end
